QcafeMongodb::Application.routes.draw do
  get "main/ngon_ngu"
  
  get "cau_hinh/index"

  get "nguoi_dung/xoa"

  get "nguoi_dung/tao_moi"

  get "media/cap_nhat"

  get "media/index"

  get "media/tao_moi"

  get "media/chi_tiet"

  get "media/xoa"

  get "bai_viet/chi_tiet_danh_muc"

  get "san_pham/chi_tiet_nhom"

  get "san_pham/them_nhom"

  get "bai_viet/cap_nhat"

  get "bai_viet/xoa"

  get "bai_viet/them_danh_muc"

  get "bai_viet/tao_moi"

  get "san_pham/cap_nhat"

  get "san_pham/xoa"

  get "san_pham/danh_muc"

  get "san_pham/them_danh_muc"

  get "san_pham/tao_moi"

  #get "nguoi_dung/index"
  get "nguoi_dung/lich_su_mua_hang"

  get "nguoi_dung/cap_nhat"
  post "nguoi_dung/cap_nhat"

  get "nguoi_dung/quen_mat_khau"
  post "nguoi_dung/quen_mat_khau"

  get "nguoi_dung/tao_mat_khau"
  post "nguoi_dung/tao_mat_khau"
  
  get "gio_hang/cap_nhat"

  get "gio_hang/xac_nhan_thong_tin"

  get "gio_hang/xac_nhan_thanh_cong"

  get "gio_hang/xoa"

  get "san_pham/index"

  get "san_pham/nhom_san_pham"

  get "bai_viet/index"

  get "bai_viet/danh_muc"

  get "main/index"
  
  match "gio_hang/mua_san_pham/(:san_pham_id)" => 'gio_hang#mua_san_pham'
  match "gio_hang/xem_gio_hang/(:gio_hang_id)" => 'gio_hang#index' , :as => :gio_hang
  
  match 'dang_nhap' => 'main#dang_nhap', :as => :dang_nhap
  match 'dang_xuat' => 'main#dang_xuat', :as => :dang_xuat
  match 'dang_ky' => 'main#dang_ky', :as => :dang_ky
  match 'ca_phe' => 'san_pham#nhom_san_pham', :defaults => {:danh_muc => 'ca_phe'}, :as => :danh_muc_ca_phe
  match 'thuc_an_nhe' => 'san_pham#nhom_san_pham', :defaults => {:danh_muc => 'thuc_an_nhe'}, :as => :danh_muc_thuc_an_nhe
  match 'giai_khat' => 'san_pham#nhom_san_pham', :defaults => {:danh_muc => 'giai_khat'}, :as => :danh_muc_giai_khat
  match 'blog_ca_phe' => 'bai_viet#danh_muc', :defaults => {:danh_muc => 'blog_ca_phe'}
  match 'tin_qcafe' => 'bai_viet#danh_muc', :defaults => {:danh_muc => 'tin_qcafe'}
  match 'san_pham/(:danh_muc_slug)/(:san_pham_slug)' => 'san_pham#index'
  match 'bai_viet/(:danh_muc_slug)/(:bai_viet_slug)' => 'bai_viet#index'
  match 'lien_he' => 'main#lien_he', :as => :lien_he
  
  #get "public/img/upload/*o"
  # The priority is based upon order of creation:
  # first created -> highest priority.

  # Sample of regular route:
  #   match 'products/:id' => 'catalog#view'
  # Keep in mind you can assign values other than :controller and :action

  # Sample of named route:
  #   match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
  # This route can be invoked with purchase_url(:id => product.id)

  # Sample resource route (maps HTTP verbs to controller actions automatically):
  #   resources :products

  # Sample resource route with options:
  #   resources :products do
  #     member do
  #       get 'short'
  #       post 'toggle'
  #     end
  #
  #     collection do
  #       get 'sold'
  #     end
  #   end

  # Sample resource route with sub-resources:
  #   resources :products do
  #     resources :comments, :sales
  #     resource :seller
  #   end

  # Sample resource route with more complex sub-resources
  #   resources :products do
  #     resources :comments
  #     resources :sales do
  #       get 'recent', :on => :collection
  #     end
  #   end

  # Sample resource route within a namespace:
  #   namespace :admin do
  #     # Directs /admin/products/* to Admin::ProductsController
  #     # (app/controllers/admin/products_controller.rb)
  #     resources :products
  #   end
  namespace :admin do
    match '' => 'main#index', :as => :admin
    match 'blog_ca_phe' => 'bai_viet#index' , :defaults => {:danh_muc => 'blog_ca_phe'}
    match 'blog_ca_phe/tao_moi' => 'bai_viet#tao_moi' , :defaults => {:danh_muc => 'blog_ca_phe'}
    match 'blog_ca_phe/cap_nhat/(:id)' => 'bai_viet#cap_nhat' , :defaults => {:danh_muc => 'blog_ca_phe'}
    match 'tin_qcafe' => 'bai_viet#index' , :defaults => {:danh_muc => 'tin_qcafe'}
    match 'tin_qcafe/tao_moi' => 'bai_viet#tao_moi' , :defaults => {:danh_muc => 'tin_qcafe'}
    match 'tin_qcafe/cap_nhat/(:id)' => 'bai_viet#cap_nhat' , :defaults => {:danh_muc => 'tin_qcafe'}
    match 'anh_upload' => 'main#anh_upload', :as => :anh_duoc_upload
    match 'upload' => 'main#upload', :as => :upload
    
    match 'ca_phe' => 'san_pham#index' , :defaults => {:danh_muc => 'ca_phe'}
    match 'ca_phe/tao_moi' => 'san_pham#tao_moi' , :defaults => {:danh_muc => 'ca_phe'}
    match 'giai_khat' => 'san_pham#index' , :defaults => {:danh_muc => 'giai_khat'}
    match 'giai_khat/tao_moi' => 'san_pham#tao_moi' , :defaults => {:danh_muc => 'giai_khat'}
    match 'thuc_an_nhe' => 'san_pham#index' , :defaults => {:danh_muc => 'thuc_an_nhe'}
    match 'thuc_an_nhe/tao_moi' => 'san_pham#tao_moi' , :defaults => {:danh_muc => 'thuc_an_nhe'}
    match 'san_pham/kich_hoat_ban_dich/(:uid)/(:ngon_ngu)' => 'san_pham#kich_hoat_ban_dich'
    match 'san_pham/vo_hieu_ban_dich/(:uid)/(:ngon_ngu)' => 'san_pham#vo_hieu_ban_dich'
    match 'san_pham/xoa/(:uid)' => 'san_pham#xoa'
    match 'san_pham/khong_xoa/(:uid)' => 'san_pham#khong_xoa'
    match 'bai_viet/xoa/(:uid)' => 'bai_viet#xoa'
    match 'bai_viet/khong_xoa/(:uid)' => 'bai_viet#khong_xoa'
    match 'san_pham/cap_nhat/(:uid)' => 'san_pham#cap_nhat'
    match 'san_pham/ban_dich/(:uid)/(:ngon_ngu)' => 'san_pham#ban_dich'
    match 'gio_hang/cap_nhat/(:uid)' => 'gio_hang#cap_nhat'
    
    get "nguoi_dung/index"
    post "nguoi_dung/index"
    get "nguoi_dung/tao_moi"
    get "nguoi_dung/xoa"
    post "nguoi_dung/tao_moi"
    get "gio_hang/index"
    get "gio_hang/xu_ly"
    get "gio_hang/khong_xu_ly"
  end

  # You can have the root of your site routed with "root"
  # just remember to delete public/index.html.
  root :to => 'main#index'

  # See how all your routes lay out with "rake routes"

  # This is a legacy wild controller route that's not recommended for RESTful applications.
  # Note: This route will make all actions in every controller accessible via GET requests.
  # match ':controller(/:action(/:id))(.:format)'
end
